def coin_change(coins, amount):
    dp = [float('inf')]*(amount+1)
    dp[0] = 0
    for a in range(1, amount+1):
        dp[a] = min((dp[a - coin] for coin in coins if coin <= a), default=dp[a])+1
    return dp[-1] if dp[-1] != float('inf') else -1


print(coin_change([5, 11], 7))
